Imports System.IO

<Serializable()> _
Friend Class FileSystemInfoCollection(Of T As FileSystemInfo)
    Inherits ObjectModel.KeyedCollection(Of String, T)

    Private _profile As Profile
    Friend Sub New(ByVal profile As Profile)
        Me._profile = profile
    End Sub

    Protected Overrides Function GetKeyForItem(ByVal item As T) As String
        Return item.Name
    End Function

    Protected Overrides Sub InsertItem(ByVal index As Integer, ByVal item As T)
        MyBase.InsertItem(index, item)
        Me._profile.IsDirty = True
    End Sub

    Protected Overrides Sub RemoveItem(ByVal index As Integer)
        MyBase.RemoveItem(index)
        Me._profile.IsDirty = True
    End Sub

    Protected Overrides Sub SetItem(ByVal index As Integer, ByVal item As T)
        MyBase.SetItem(index, item)
        Me._profile.IsDirty = True
    End Sub

    Protected Overrides Sub ClearItems()
        MyBase.ClearItems()
        Me._profile.IsDirty = True
    End Sub
End Class
